package com.dfcj.oauth2security.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }

    @PreAuthorize(value=("hasAuthority('Role_Admin')"))
    @GetMapping("/oauth2")
    public String oauth(){
        return "hello,oauth2";
    }

    @PreAuthorize(value=("hasAuthority('Role_Admin')"))
    @GetMapping("/hello/test")
    public String test(){
        return "hello,test";
    }
}
